﻿using Admin.Model;
using Admin.Model.ResponseModel;
using AutoMapper;

namespace Admin.Web.AutoMapper
{
    public class DataProfile : Profile
    {
        /// <summary>
        /// 配置构造函数，用来创建关系映射
        /// </summary>
        public DataProfile()
        {
            CreateMap<SysUser, ExcelSysUser>();
            CreateMap<ExcelSysUser, SysUser>();
            CreateMap<SysMenu, MenuZtree>()
                .ForMember(d => d.Id, o => o.MapFrom(s => s.Id))
                .ForMember(d => d.Title, o => o.MapFrom(s => s.Name))
                .ForMember(d => d.PId, o => o.MapFrom(s => s.ParentId))
                .ForMember(d => d.Name, o => o.MapFrom(s => s.Name + $"<font color='#888'>&nbsp;&nbsp;&nbsp;{s.Identify}</font>"));
        }
    }
}
